package net.htjs.juc.waitnotify;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

@Slf4j
public class Demo2 {

    final static Object obj = new Object();

    public static void main(String[] args) throws InterruptedException {

        new Thread(() -> {
            synchronized (obj) {
                log.info("执行.....");
                try {
                    //让进入object监视器的线程到waitSet等待
                    obj.wait(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                log.info("其他代码");
            }
        }, "t1").start();

    }

}
